#ifndef SUMIC_H
#define SUMIC_H

#include "IndexCalculator.h"

template <typename T = double>
class SumIC : public IndexCalculator<T, T>
{
public:
    SumIC(int period) : IndexCalculator<T, T>(period) {}

    void calculate(const T &new_data) override
    {
        if (this->data_count <= this->period)
        {
            this->result += new_data;
        }
        else
        {
            this->result += new_data - this->data[0];
        }
    }
};

#endif // SUMIC_H